package com.lxl.rabbitmq;

import com.lxl.config.SystemConfig;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: rabbitmq
 * @author: wuchun
 * @description: 消息发送
 * @create: 2018/9/29 09:50
 */
@Component
public class MessageSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void sendMessage(String queueName, String message) {
        try {
            this.rabbitTemplate.convertAndSend(queueName, message);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        MessageSender messageSender = new MessageSender();
        messageSender.sendMessage(SystemConfig.QUEUE_PROC_NAME,"ceshihihihihihi");
    }

}
